package com.vincent.controller.admin;


import com.vincent.common.R;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class ExceptionController {
    @ExceptionHandler(IncorrectCredentialsException.class)
    public R exceptionHandler(IncorrectCredentialsException e){
        e.printStackTrace();
        return R.error("用户名或密码错误");
    }

    @ExceptionHandler(Exception.class)
    public R exceptionHandler(Exception e){
        e.printStackTrace();
        return R.error(e.getMessage());
    }
}
